package cn.tedu.sp02.service;

import cn.tedu.sp01.entity.Item;
import cn.tedu.sp01.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author 作者：小龙猿
 * @Project 项目：springcloud1
 * @Time 时间：2021/9/9 11:42
 */
@Service
@Slf4j
public class ItemServiceImpl implements ItemService {
    @Override
    public List<Item> getItems(String orderId) {
        log.info("获取商品===orderId="+orderId);
        ArrayList<Item> list = new ArrayList<>();
        list.add(new Item(1, "商品1", 1));
        list.add(new Item(2, "商品2", 2));
        list.add(new Item(3, "商品3", 3));
        list.add(new Item(4, "商品4", 4));
        list.add(new Item(5, "商品5", 5));
        return list;
    }
    @Override
    public void decreaseNumbers(List<Item> list) {
        for (Item item : list) {
            log.info("减少库存: "+item);
        }
    }
}
